<%-- 
    Document   : visualiza
    Created on : 14/09/2011, 11:34:51
    Author     : Rachid
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <h3>Itens do seu carrinho de compras</h3>
        <table>
            <thead>
                <tr>
                    <th>Nome</th>
                    <th>Descrição</th>
                    <th>Remover Produto</th>
                    <th>Preço</th>
                    <th>Qtde</th>
                    <th>Total</th>
                </tr>
            </thead>
            <tbody>
                <c:forEach items="${carrinho.itens}" var="item" varStatus="s">
                    <tr>
                        <td>${item.produto.nome }</td>
                        <td>${item.produto.descricao }</td>
                        <th>
                            <a href="remove?id=${s.index}">Remover</a>
                        </th>
                        <td><fmt:formatNumber type="currency" value="${item.produto.preco }"/></td>
                        <td>${item.quantidade }</td>
                        <td><fmt:formatNumber type="currency"
                                          value="${item.quantidade * item.produto.preco }"/></td>
                    </tr>
                </c:forEach>
            </tbody>
            <tfoot>
                <tr>
                    <td colspan="3"></td>
                    <th colspan="2">Total:</th>
                    <th><fmt:formatNumber type="currency" value="${carrinho.total }"/></th>
                </tr>
            </tfoot>
        </table>
    </body>
</html>